N,M=map(int,input().split())

class win:
    def __init__(self,x1,y1,x2,y2,no):
        self.x1=x1
        self.y1=y1
        self.x2=x2
        self.y2=y2
        self.no=no

ws=[]
for i in range(1,N+1):
    x1,y1,x2,y2=map(int,input().split())
    ws.insert(0,win(x1,y1,x2,y2,i))

for i in range(0,M):
    x,y=map(int,input().split())
    nw=None
    for w in ws:
        if w.x1<=x and w.x2>=x and w.y1<=y and w.y2>=y:
            nw=w
            break
    if nw is None:
        print("IGNORED")
    else:
        ws.remove(nw)
        ws.insert(0,nw)
        print(nw.no)